package services.common;

import java.util.List;

import models.common.bean.CommercialPaperRecord;
import models.common.entity.t_commercial_paper_record;
import services.base.BaseService;

import common.utils.Factory;
import common.utils.PageBean;

import daos.common.CommerciaPaperRecordDao;

/**
 * 商票跟踪表service
 *@author xiaojun
 *@version 2017-4-14 下午4:30:22
 */
public class CommerciaPaperRecordService extends BaseService<t_commercial_paper_record>{
	
	private CommerciaPaperRecordDao commerciaPaperRecordDao;
	protected CommerciaPaperRecordService(){
		commerciaPaperRecordDao=Factory.getDao(CommerciaPaperRecordDao.class);
		super.basedao=commerciaPaperRecordDao;
		
	}
	
	/**
	 * 根据商票id查询商票跟踪表信息
	 * @param commer_paper_id
	 * @return
	 * @author xiaojun
	 *@version 2017-4-14 下午4:30:22
	 */
	public List<t_commercial_paper_record> findByCpi(long commer_paper_id){
		
		return commerciaPaperRecordDao.findByCpi(commer_paper_id); 
	}
	/**
	 * 根据商票id分页查询商票跟踪表信息
	 * @param commer_paper_id
	 * @param currPage
	 * @param pageSize
	 * @return
	 * @author xiaojun
	 *@version 2017-4-14 下午4:30:22
	 */
	public PageBean<CommercialPaperRecord> findReceiveByCpi(long commer_paper_id,int currPage, int pageSize){
		return commerciaPaperRecordDao.findReceiveByCpi(commer_paper_id,currPage,pageSize); 
	}

	/**
	 * 更新商票跟踪表信息
	 *
	 * @param t 商票跟踪表实体
	 * @return
	 * @author xiaojun
	 *@version 2017-5-3 下午7:20:42
	 */
	public boolean saveCommerciaPaperRecord(t_commercial_paper_record t){
		return commerciaPaperRecordDao.save(t);		
	}
	/**
	 * 查询背书记录
	 *
	 * @param commer_paper_id 商票id
	 * @param type 类型
	 * @return
	 * @author xiaojun
	 *@version 2017-6-7
	 */
	public List<CommercialPaperRecord> queryByType(long commer_paper_id ,int type){
		return commerciaPaperRecordDao.queryByType(commer_paper_id, type);	
	}
}
